    function changePx(){
        document.documentElement.style.fontSize = document.documentElement.clientWidth<=640?document.documentElement.clientWidth / 640*100 + 'px':100 + 'px'
    }
    window.onresize = function(){
        changePx()
    }
    /*loaction.search分解成对象*/
    function getSerch(str) {
        var o = {};
        str = str.replace(/\?/ig,"");
        str = str.split('&');
        str.forEach(function (v,i) {
            var arr = v.split("=");
            o[arr[0]] = arr[1];
        });

        return o;
    }
    //跑马灯效果
    var timeInter, wrapper,inner,p,p_w,wrapper_w;
    function fun(){
        wrapper = document.getElementById('wrapper');
        inner = wrapper.getElementsByTagName('div')[0];
        p = wrapper.getElementsByTagName('ul')[0];
        p_w = p.offsetWidth;
        wrapper_w = wrapper.offsetWidth;
        clearTimeout(timeInter);
        if(wrapper_w > p_w){
            return false;
        }else{
            p.innerHTML+=p.innerHTML;
            timeInter=setTimeout("fun1()",100);
        }
    }
    function fun1(){
        if(p_w > wrapper.scrollLeft){
            wrapper.scrollLeft++;
            timer=setTimeout("fun1()",50);
        }
        else{
            wrapper.scrollLeft=0;
            fun1()
        }
    }
    //loading
    function loading(){
        var counter = 0;
        var c = 0;
        var i = setInterval(function(){
            $(".loading-page .counter h1").html(c + "%");
            $(".loading-page .counter p").css("width", c + "%");
            counter++;
            c++;
            if(counter == 101) {
                clearInterval(i);
                $('body').addClass('loaded');
            }
        }, 14);
    }
    //音乐
    var flag=false,$img = $('#icon'),isPlaying=false;
    $img.click(function(){
        if(!flag){
            paused();
            //音乐停止
            $("#audio").get(0).pause();
            flag=true;
        }else{
            running();
            //音乐播放
            $("#audio").get(0).play();
            flag=false;
        }
    })
    function running(){
        $img.addClass('play')
        isPlaying = true
    }
    function paused(){
        var siteImg = $img.css('transform')  //获取当前元素的动画改变，transform的值
        var siteWp = $('.music').css('transform')
        $('.misic').css('transform',siteWp === 'none' ? siteImg : siteImg.concat('',siteWp))
        $img.removeClass('play')
        isPlaying = false
    }
    function audioAutoPlay(id){
        var audio = document.getElementById(id),

            play = function(){
                audio.play();
                document.removeEventListener("touchstart",play, false);
            };
        running();
        audio.play();
        document.addEventListener("WeixinJSBridgeReady", function () {//微信
            play();
        }, false);
        document.addEventListener("YixinJSBridgeReady", function() {//易信
            play();
        }, false);
        document.addEventListener("touchstart",play, false);
    }
    //弹出弹出
    function showModal(that){
        var num=$(that).data('num');
        $("body").css("overflow","hidden");
        $('.fixed_show'+num).show();
    }
    //回到顶部按钮
    $(window).scroll(function(){
        if ($(window).scrollTop()>1000){
            $("#toTop").show(200);
        }
        else
        {
            $("#toTop").hide(200);
        }
    });
    //当点击后，回到页面顶部位置
    $("#toTop").click(function(){
        var scrollToTop = window.setInterval(function() {
            var pos = window.pageYOffset;
            if ( pos > 0 ) {
                window.scrollTo( 0, pos - 80 );
            } else {
                window.clearInterval( scrollToTop );
            }
        }, 16);
    });
    //验证手机号
    function isPoneAvailable($poneInput) {
        var myreg=/^[1][3,4,5,7,8][0-9]{9}$/;
        if (!myreg.test($poneInput.val())) {
            return false;
        } else {
            return true;
        }
    }
    //验证年龄格式（年龄只能0~99，两位数）
    function ValidateUserAge(age)
    {
        var regNum = /^[0-9]{1,2}$/;
        if (regNum.test(age)) {
            return true;
        }
        else {
            return false;
        }
    }
    //获取二维码
    //获取二维码
    $('#QRCode').click(function(){
        var _this=$(this)
        var type=_this.data('num'),url;
        console.log(type)
        if(type==2){
            url='http://api.ucmd.cn/renren-api/wx/activity/wxc57d0b29494417fe/qrCode?openId='+getSearchObj.openId+'&type='+type+'&content='+document.title
        }else{
            var firstOpenId=_this.attr('data-firstOpenId')
            url='http://api.ucmd.cn/renren-api/wx/activity/wxc57d0b29494417fe/qrCode?openId='+getSearchObj.openId+'&type='+type+'&firstOpenId='+firstOpenId+'&content='+document.title
        }
        $.ajax({
            type: "get",
            contentType: "application/json;charset=UTF-8",
            url: url,
            success: function(result) {
                if(result.code==0){
                    $('.QRCode-img').attr('src',result.data.fileUrl);
                    $('.fixed_show'+type).show();
                }else{
                    swal({
                        title:result.msg,
                        icon: "warning",
                        button: "确认",
                        dangerMode: true
                    })
                }
            }
        });
    })
    